In this module, we will talk about
analog-to-digital and digital-to-analog conversion, try to understand how
these things are done in practice. We have seen that sampling
discretizes time and quantization discretizes amplitude. How is it done in practice? The answer is cheaply and
in a very compact way. This photograph shows you
the few discreet electronic components that you have to put together
to build an analog-to-digital converter. And if you did so, you would probably end
up one of the largest digital-to-analog converters in existence, because in
most cases like in your cellphone the whole circuit would be integrated and
be neutralized. At the heart of both digital-to-analogue
and analogue-to-digital converters is a circuit called the operational
amplifier, or op-amp for short. The op-amp has two inputs. The inverting input and
the non-inverting input and one output. And the input, output, relationship
is that the voltage at the output is equal to the difference between
the voltages at the inverting and non-inverting input times the gain factor. We idealize the op-amp by saying
that it has Infinite input gain, and zero input current. And although these are, of course,
idealizations, practical implementations of correctional amplifiers
are remarkably close to this ideal. And not very complex either, because this,
for instance, is the schematics for an operational amplifier, and you can see
that it requires only six transistors, and one resistor. The operational amplifier can
be used in two configuration, the open loop and closed loop. In the open loop configuration,
the op-amp works as a comparator. You put a reference voltage
at the inverting input and a test voltage at the non-inverting input. As soon as the difference between these
two voltages is non-zero the output due to the infinite gain will shoot up or
down to the maximum or minimum allowed output voltage
which coincides with the voltage of the power supply
that powers the op-amp. In the closed loop configuration
we have a feedback path that links the output
to the inverting input. So what happens when we apply
a voltage to the non-inverting input? Well, if the voltage at
the inverting input is less than x, then the difference between inverting and
non-inverting would drive the output up. Conversely, if the voltage
here was larger than x, the difference would be negative and
this would drive the output down. So the only equilibrium point for the system is when the voltage at
the inverting input is exactly equal to x, which of course means that the output
voltage is equal to x as well. So the input-output relationship of the
closed loop is output equal to the input. This configuration is
known as a buffer stage, because although the output has the same
voltage as the input, the second property of the ideal op-amp prevents any current
from flowing into the amplifier. And therefore there is
a separation between this side and that side of the amplifier. This is very useful for taking measurements without
perturbing the measured quantity. We can complexify the closed loop a little
bit by adding a couple of resistors. In this case we have what is
called an inverting amplifier. This is only slightly more complex than
the simple closed loop we saw before. Again, the system will stabilize when
the difference between inverting and non-inverting inputs is zero. So we can say that voltage here,
let's call it V0 is equal to 0 because the non-inverting
input is connected to ground. That means that the current flow-in in the
first resistor will be according to Ohm's law, i0 = x/R1. This current will not be able to
flow into the operational amplifier because of the second law, so it'll
have to flow into this resistor here. And therefore the output
voltage will be just the voltage's drop over R2 caused by i0. And so y = -R2/i0,
which gives us the final input-output relationship for
the inverting amplifier. The output is a fraction of
the input with a change of sign. We're now ready to look
at an A/D converter. The device starts with the sample and
hold circuit that performs the sampling. So we have our analogue input here. Here we have an op-amp in
buffer configuration and here we have a mosfet which
is really like a switch. And here we have a train of
pulses at the sampling frequency. When a pulse reaches
the gate at the mosfet, the mosfet closes very briefly and
allows the first buffer to charge this capacitor to the
instantaneous level of the input signal. The capacitor is connected to another
buffer stage that will put out the value measured by the capacitor for the duration
of the interval between pulses. We put a buffer stage here so
that we can put out a constant voltage without discharging the capacitor
between sample and instance. An analog-to-digital converter needs not
only to sample the input signal, but also to quantize it. So the sample on hold provides a stable
voltage level between sampling times and now we need a circuit that
converts that to binary format. Here we have a simple
diagram of a 2-Bit quantizer. What this quantizer does is take
a maximum positive voltage V0 and a minimum negative voltage -V0,
this could be the A and B extrema that we used in
our quantization example. And then it uses a series of
four resistors of equal value to produce intermediate boundary levels,
the iKs in our quantization example, that will be
used to define the quantization regions. Here you have +0.5 volts,
you have 0 volts, you have -0.5 volts. So we're dividing the interval from V0 to
-V0 into four equally spaced intervals. These reference voltages here are used
with the bank of competitors, so operational amplifiers in
open loop to determine which quantization interval the current
sample value belongs to. So let's work out an example
with an input voltage of 0.2 V0. So what we have here is that
the first comparator will have 0.2 volts at the non-inverting input
with the reference of 0.05 volts. So the reference is higher, so here
the out put will be a negative voltage This competitor will compare
0.2 volts to 0 volts. And so, this competitor will output
a positive voltage, and similarly, this one will compare 0.2 to -0.5, so
again, the output will be positive. Next we have a logic
network that will encode this comparison levels
into a binary value. These are exclusive or gates and the truth
table for these gates is the following. So the output will be positive only
if the inputs are of different sign. So this gate will output
a positive level and this gate will output a negative level. Now we have a network of dyads that
acts as a parallel to serial converter. So we have a negative voltage here that
will be blocked by these two dyads, so nothing happens here. A positive voltage here
that will go through, and will indicate the most significant
bit out of the quantizer. Since this is positive,
the most significant bit will be 1. And here, the negative voltage will
not go through the diode, so the least significant bit will be connected to
the ground and it will be equal to 0. So the voltage of 0.2V0 will be
encoded by the binary notation 1,0. Finally, let's look at the D/A converter. Suppose we have a sample
in binary notations, so x(n) = a set of bits from 0, b1 to b R-1, so we use R bits per sample. We use this binary representation
to drive a bank of voltage generators at voltage V0. So in the previous example we
had a 2-Bit quantizer that gave us a representation for
our current value of 1,0. So in that case, if we were to apply
that value to this bank of generators, this voltage generator would be on and
this voltage radio will be off. This generator are connected
to resistor structure that is known under the name of R-2R ladder. Now the details of this structure
are a little bit tedious to work out. But if you're patient and
you apply Thevenin's Theorem to this ladder you will see
that the system seen by this point in the circuit is
equivalent to a resistor of value R connected to voltage source
of value V equal to the sum for K that goes from 0 to R-1 of V0
divided by 2 to the K times bK. So in other words,
each bit in the binary representation of the sample contributes a voltage
source of value v0/2K, where K is the position of the bit
in the binary representation. So if this is equivalent to a voltage source of value K V0/2K b0, plus a resistor of value R. This is simply an inverting amplifier and
the value out here will be -V0 times x where x is our binary
representation on the input. The resulting signal will be a piece-wise
constant signal where the transitions between levels will be dictated by
the speed at which new samples appear at the voltage generator bank.